<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" th:href="@{res/css/amazeui.min.css}">
    <link rel="stylesheet" th:href="@{res/css/admin.css}">
    <script th:src="@{/js/jquery-1.11.3.min.js}"></script>
    <script th:src="@{myplugs/js/plugs.js}"></script>
    <style>
        .admin-main {
            padding-top: 0px;
        }
    </style>
</head>
<body>
<div class="am-cf admin-main">
    <!-- content start -->
    <div class="admin-content" style="overflow: hidden">
        <div class="admin-content-body">
            <div class="am-g">
                <div class="am-form am-form-horizontal"
                     style="padding-top:10px;">
                    <div class="am-form-group">
                        <span style="margin: 0px 0px 0px 110px">是否确认删除?</span>
                    </div>
                    <div class="am-form-group" style="margin: 0px 100px 0px 0px">
                        <div class="am-u-sm-9 am-u-sm-push-3" style="margin: 0px 0px 0px 26px">
                            <input type="button" class="am-btn am-btn-primary" value="确认" id="confirm"/>
                            <input type="button" class="am-btn am-btn-primary" value="取消" id="cancel"/>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>

<script>
    function GetRequest() {
        var url = location.search; //获取url中"?"符后的字串
        var theRequest = new Object();
        if (url.indexOf("?") != -1) {
            var str = url.substr(1);
            strs = str.split("&");
            for (var i = 0; i < strs.length; i++) {
                theRequest[strs[i].split("=")[0]] = decodeURIComponent(strs[i].split("=")[1]);
            }
        }
        return theRequest;
    }

    $(function () {
        var Request = new Object();
        Request = GetRequest();
        var id = Request["id"];

        $("#confirm").click(function () {
            $.ajax({
                type: "post",
                url: "/user/deleteUser",
                dataType: "text",
                data: {id: id},
                success: function (result) {
                    parent.location.reload();
                },
                error: function (result) {
                    alert("删除用户失败!");
                }
            })
        })

        $("#cancel").click(function () {
            parent.location.reload();
        });

    })

</script>
</html>